<template>
	<view>
		<view style="width: 95%;margin: auto;">
			<uni-search-bar v-model="orderNumber" @cancel="cancel" @confirm="search" ></uni-search-bar>
		</view>
		<view style="width: 95%;margin: auto;">
			<uni-list>
				<uni-list-item v-for="(item,index) in YsOrder" 
								:key="index" 
								:title="item.orderNumber" 
								:note="'时间:'+item.orderDate"
								link :to="'./myOrderDetails?orderNumber='+item.orderNumber"
								>
				</uni-list-item>
			</uni-list>
		</view>
	</view>
</template>

<script>
	import {getAllYSOrder} from "../../../api/order.js";
	export default {
		data() {
			return {
				YsOrder:[],
				orderNumber:null
			}
		},
		onLoad() {
			this.getOrderInfo();
		},
		methods: {
			search(){
				this.getOrderInfo()
			},
			cancel(){
				this.orderNumber = null
				this.getOrderInfo()
			},
			getOrderInfo(){
				getAllYSOrder(this.orderNumber).then(res=>{
					this.YsOrder = res.data.records
					console.log(res.data.records,'订单数据');
				})
			}
		}
	}
</script>
<style>
</style>
